#define _CRT_SECURE_NO_WARNINGS 1
//#include<iostream>
//#include<list>
//#include<vector>
//#include<string>
//using namespace std;
//#include"List.h"
//#include"vector.h"
//void func(const zcg::List<int>& It)
////{
////	zcg::List<int>::const_reverse_iterator rit= It.rbegin();
////	while (rit != It.rend())
////	{
////		cout << *rit << " ";
////		++rit;
////	}
////	cout << endl;
////}
////int main()
////{
////	zcg::List<int> It;
////	It.push_back(1);
////	It.push_back(2);
////	It.push_back(3);
////	It.push_back(4);
////	It.push_back(5);
////	//zcg::List<int>::iterator it = It.begin();
////	//while (it != It.end())
////	//{
////	//	cout << *it << " ";
////	//	++it;
////	//}
////	//func(It);
////	zcg::List<int>::reverse_iterator rit = It.rbegin();
////	while (rit != It.rend())
////	{
////		cout << *rit << " ";
////		++rit;
////	}
////	cout << endl;
////	func(It);
////	return 0;
////}
////void func(const zcg::vector<int>& It)
////{
////	zcg::vector<int>::const_reverse_iterator rit = It.rbegin();
////	while (rit != It.rend())
////	{
////		cout << *rit << " ";
////		++rit;
////	}
////	cout << endl;
////}
////int main()
////{
////	zcg::vector<int> It;
////		It.push_back(1);
////		It.push_back(2);
////		It.push_back(3);
////	    It.push_back(4);
////		It.push_back(5);
////		zcg::vector<int>::iterator it = It.begin();
////		while (it != It.end())
////		{
////			cout << *it << " ";
////			++it;
////		}
////		cout << endl;
////		func(It);
////	//	zcg::List<int>::reverse_iterator rit = It.rbegin();
////	//	while (rit != It.rend())
////	//	{
////	//		cout << *rit << " ";
////	//		++rit;
////	//	}
////	//	cout << endl;
////	//	func(It);
////	//	return 0;
////		
////}
//class Date
//{
//public:
//	Date(int year = 1900, int month = 1, int day = 1)
//		: _year(year)
//		, _month(month)
//		, _day(day)
//	{}
//
//	bool operator<(const Date& d) const
//	{
//		return (_year < d._year) ||
//			(_year == d._year && _month < d._month) ||
//			(_year == d._year && _month == d._month && _day < d._day);
//	}
//
//	bool operator>(const Date& d) const
//	{
//		return (_year > d._year) ||
//			(_year == d._year && _month > d._month) ||
//			(_year == d._year && _month == d._month && _day > d._day);
//	}
//
//	friend ostream& operator<<(ostream& _cout, const Date& d);
//private:
//	int _year;
//	int _month;
//	int _day;
//};
//
////template<class T>
////bool Less(T left, T right)
////{
////	return left < right;
////}
////template<>
////bool Less<Date*>(Date*left,Date*right)
////{
////	return *left < *right;
////}
////int main()
////{
////	Date* d1 = new Date(2023, 10, 8);
////	Date* d2 = new Date(2023, 10, 9);
////	cout << Less(d1, d2) << endl;
////
////	return 0;
////}
//template<class T>
//bool Less(const T& left, const T& right)
//{
//	return left < right;
//}
//bool Less(Date*left,Date*right)
//{
//	return *left < *right;
//}
//int main()
//{
//	Date* d1 = new Date(2023, 10, 8);
//	Date* d2 = new Date(2023, 10, 9);
//	cout << Less(d1, d2) << endl;
//	cout << Less(1, 2) << endl;
//	return 0;
//}
//#include <iostream>
//using namespace std;
//
//int main()
//{
//    int count,num;
//    int nums = 0;
//    int zhenshu = 0;
//    int fushu = 0;
//    cin >> count;
//    while (count--)
//    {
//        cin >> num;
//        if (num >=0)
//        {
//            nums += num;
//            zhenshu++;
//        }
//        else
//        {
//            fushu++;
//        }
//    }
//    double n = nums / zhenshu;
//    printf("%d %.1f",fushu, n);
//
//}
//#include<vector>
//#include<iostream>
//using namespace std;
//#include<algorithm>
//class Solution {
//public:
//    int minNumberInRotateArray(vector<int>& nums) 
//    {
//        sort(nums.begin(), nums.end());
//        cout << nums[0];
//    }
//};
//#include<iostream>
//#include<vector>
//using namespace std;
//#include<algorithm>
//class Solution {
//public:
//    vector<int> findErrorNums(vector<int>& nums)
//    {
//        vector<int>ans;
//        sort(ans.begin(), ans.end());
//        int count = 0,num=0;
//        for (int i = 0; i < nums.size()-1; i++)
//        {
//            if (nums[i + 1] - nums[i] == 0)
//            {
//                ans.push_back(nums[i]);
//                break;
//            }
//        }
//        for (int i = 0; i < nums.size(); i++)
//        {
//            num += i+1;
//            count += nums[i];
//        }
//        count -= ans[0];
//        ans.push_back(num - count);
//        return ans;
//    }
//};
//int main()
//{
//    vector<int> nums{ 2,3,2 };
//    Solution num;
//    num.findErrorNums(nums);
//}
#include <iostream>
using namespace std;

int main() {
    int a;
    cin >> a;
    while (a--)
    {
        int flag = 1;
        string s;
        cin >> s;
        if (s.size() > 100)
        {
            cout << "NO";
        }
        for (int i = 0; i < s.size(); i++)
        {
            if ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= '0' && s[i] <= '9') || (s[i] >= 'A' && s[i] <= 'Z'))
            {
                continue;
            }
            else
            {
                flag = 0;
                cout << "NO" << endl;
                break;
            }
        }
        if(flag==1)
        {
            cout << "YES" << endl;
        }
       
    }
}